<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:f="http://xmlns.4suite.org/ext"
  xmlns:func="http://exslt.org/functions" 
  xmlns:exslt="http://exslt.org/common" 
  xmlns:date="http://exslt.org/dates-and-times"
  xmlns:str="http://exslt.org/strings"
  xmlns:url="http://xmlns.heustics.org/xslt/ext/urllib/0.1/"
  xmlns:w="http://xmlns.heustics.org/xslt/ext/wiki/0.1/"  
  xmlns:i18n="http://xmlns.heustics.org/xslt/ext/i18n/0.1/"
  xmlns:a="http://xmlns.heustics.org/schema/myelin/0.1/"  
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  xmlns:o="&a;base#"  
  xmlns:fres="http://xmlns.4suite.org/reserved"
  extension-element-prefixes="f func i18n w url"
  exclude-result-prefixes="xsl f exslt date str url i18n func l a o fres"
>
  <xsl:import href="common.xslt"/>
  
  <xsl:param name="a:imports"/> 
  
  <xsl:variable name="a:i18n" select="i18n:import-resources()/*"/>
  
  <xsl:variable name="a:site-info" select="a:site-info()"/>
  <xsl:variable name="a:site-page" select="a:site-page()"/>
  
  <xsl:variable name="o:l10n" select="$a:i18n/*[@id='&a;base']"/>
  <xsl:variable name="o:title-l10n" select="$o:l10n/l:context[@name='titles']/*"/>
  <xsl:variable name="o:actions-l10n" select="$o:l10n/l:context[@name='actions']/*"/>
  
  <xsl:variable name="o:theme-i18n" select="$a:i18n/*[@theme]/*"/>
    
  <func:function name="a:get-l10n">
    <xsl:param name="id"/>
    <func:result select="$a:i18n/*[@id=$id]"/>
  </func:function>
  
  <!-- more URL helpers -->
  <func:function name="a:format-keyword-search">
    <xsl:param name="url"/>
    <xsl:param name="kw"/>
    <func:result 
      select="concat($url,
        '&amp;quick-search=1&amp;search=search&amp;event=search&amp;',
        a:encode-url-param-chain(
          'locale',$a:source-root/@content-locale,
          a:encode-url-param('query',$kw)
        )
      )"/>
  </func:function>
  
  <func:function name="a:is-root">
    <xsl:param name="url" select="$a:current-url"/>
    <xsl:choose>
      <xsl:when test="$url = $a:root-url or $url = $a:root-path">
        <func:result select="1"/>
      </xsl:when>
      <xsl:otherwise>
        <func:result select="0"/>
      </xsl:otherwise>
    </xsl:choose>     
  </func:function> 
  
  <func:function name="a:not-root-node">
    <xsl:param name="node"/>
    <func:result select="$node != $a:config/@root-uri"/>
  </func:function>
  
  <func:function name="a:check-acl">
    <xsl:param name="a"/>
    <func:result select="$a:node-acls/*[@action=$a]"/>
  </func:function>
  
  <func:function name="a:check-new-acl">
    <xsl:param name="a"/>
    <func:result select="$a:node-acl/a:acl-group[@name='new-node-types']/*[@action=$a]"/>
  </func:function>
    
  <func:function name="a:format-date">
    <xsl:param name="d"/>
    <func:result select="date:adjust-date-to-timezone($a:timezone,$d)"/>
  </func:function>
  
  <func:function name="a:format-time">
    <xsl:param name="d"/>
    <func:result select="date:adjust-time-to-timezone($a:timezone,$d)"/>
  </func:function>  
  
  <func:function name="a:format-target">
    <xsl:param name="a"/>
    <xsl:param name="b"/>
    <xsl:if test="string-length($a) and ($a != $b and concat($a,$a:config/@default-node-name) != $b)">
      <func:result select="concat('&amp;target=',$a)"/>
    </xsl:if>
  </func:function>
  
  <func:function name="a:format-target-action">
    <xsl:param name="a"/>
    <xsl:param name="b"/>
    <xsl:if test="$a != $b and $a != $a:config/@default-action">
      <func:result select="concat('&amp;target-action=',$a)"/>
    </xsl:if>
  </func:function>
  
  <func:function name="a:site-info">
    <xsl:param name="base-uri" select="string($a:config/@server-l10n-root)"/>
    <xsl:if test="string-length($base-uri)">
      <xsl:variable name="uri" select="concat($base-uri,$a:locale,'/',$a:config/@server-l10n-node-name)"/>
      <xsl:variable name="doc" select="document($uri)/*/*"/>
      <xsl:variable name="si" select="$doc[contains(@locale,$a:locale)]/*"/>
      <xsl:choose>
        <xsl:when test="$si">
          <func:result select="$si"/>
        </xsl:when>
        <xsl:otherwise>
          <func:result select="$doc[1]/*"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:if>
  </func:function>
  
  <func:function name="a:site-page">
    <xsl:param name="site-page" select="$a:site-info[@name='site-page']/*"/>
    <xsl:choose>
      <xsl:when test="$site-page[@key=$a:theme]">
        <func:result select="document($site-page[@key=$a:theme]/@uri)/*/*"/>
      </xsl:when>
      <xsl:when test="$site-page[1]/@uri">
        <func:result select="document($site-page[1]/@uri)/*/*"/>
      </xsl:when>
    </xsl:choose>
  </func:function>  
  
  <!-- start templates -->
  <xsl:template match="*"/>
  <xsl:template match="*" mode="a:main-head"/>  
  <xsl:template match="*" mode="a:main-header"/>
  <xsl:template match="*" mode="a:main-nav"/>
  <xsl:template match="*" mode="a:main-actions"/>
  <xsl:template match="*" mode="a:main-content"/>
    
  <xsl:template name="a:html-content">
    <head profile="http://dublincore.org/documents/dcq-html/">                              
      <xsl:apply-templates mode="a:head"/>
      <xsl:variable name="favicon" select="$a:site-info[@name='site-general']/*[@key='favicon']"/>
      <xsl:if test="$favicon">
        <link rel="shortcut icon" href="{$favicon/@href}"/>
      </xsl:if>
    </head>
    <body>
      <div id='body'>
        <xsl:apply-templates mode="a:body"/>
        <div class="spacer"/>
      </div>        
    </body>
  </xsl:template>
  
  <xsl:template match="*" mode="a:head"/>
  <xsl:template match="*" mode="a:body"/>
  
  <!-- head -->
  <xsl:template match="a:*[@resource-uri]" mode="a:head">
    <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"/>
    <link rel="schema.DCTERMS" href="http://purl.org/dc/terms/"/>
    <link rel="schema.MYELIN" href="http://xmlns.heustics.org/ontology/myelin/0.1/"/>
    <xsl:if test="@sparql-endpoint">
      <link rel="&m;sparql-endpoint" href="{@sparql-endpoint}" type="{$a:current-mime-type}"/>
    </xsl:if>
    <xsl:if test="@versa-endpoint">
      <link rel="&m;versa-endpoint" href="{@versa-endpoint}" type="{$a:current-mime-type}"/>
    </xsl:if>
    <xsl:if test="@keyword-search-endpoint">
      <link rel="&m;keyword-search-endpoint" href="{@keyword-search-endpoint}" type="{$a:current-mime-type}"/>
    </xsl:if>
    <meta name="created" content="{@date-time}"/>
    <meta name="DC.identifier" scheme="DCTERMS.URI" content="{@document-id}"/>
    <meta name="DC.source" scheme="DCTERMS.URI" content="{@node-id}"/>
    <meta name="DC.publisher" scheme="DCTERMS.URI" content="{@domain-uri}"/>
    <xsl:apply-templates mode="a:head-content"/>
  </xsl:template> 
  
  <!-- head content -->
  <xsl:template match="*" mode="a:head-content"/>
  
  <xsl:template match="a:head" mode="a:head-content">
    <xsl:apply-templates mode="a:head-content"/>
  </xsl:template>
  
  <xsl:template match="a:account" mode="a:head-content">
    <xsl:apply-templates mode="a:head-content"/>    
  </xsl:template>
  
  <!-- preferences -->  
  <xsl:template match="a:preferences" mode="a:head-content">
    <xsl:apply-templates 
      select="$o:theme-i18n[@name='stylesheets']/*[not(@method) or @method=$a:method]" 
      mode="a:head-stylesheet"/>
  </xsl:template> 
  
  <xsl:template match="l:stylesheet[not(@ie-only)]" mode="a:head-stylesheet">
    <link rel='{@rel}' type='{@imt}' 
      href="{a:format-stylesheet-path(a:public-static-url(@uri))}">
      <xsl:copy-of select="@media"/>
    </link>
  </xsl:template>
  
  <!-- methods -->
  <xsl:template match="a:methods" mode="a:head-content">
    <xsl:for-each select="*[not(@selected)]">
      <link rel='alternative'
        type='{@imt}'
        href='{a:format-url-method(string(@key))}'/>
    </xsl:for-each>
  </xsl:template>  
  
  <!-- head title -->
  <xsl:template match="a:title" mode="a:head-content" name="a:head-title">
    <xsl:param name="l10n" select="$o:title-l10n"/>
    <xsl:param name="key" select="@key"/>
    <xsl:param name="title" select="concat($l10n[@key=$key],.)"/> 
    <title>
      <xsl:call-template name="a:lang-attr"/>
      <xsl:value-of select="concat($a:site-info[@name='site-general']/*[@key='head-title'],$title)"/>
    </title>        
  </xsl:template>
  
  <!-- start of body specifics -->
  <xsl:template match="a:*[@resource-uri]" mode="a:body"> 
  
    <xsl:if test="$a:site-info">
      <div id='main-site-header' class='page-section site-header-section'>
        <xsl:apply-templates select="." mode="a:site-header"/>
        <div class="spacer"/> 
      </div>
      <div id='main-site-links-header' class='page-section site-links-header-section'>
        <xsl:apply-templates select="." mode="a:site-links-header"/>
        <div class="spacer"/> 
      </div>
    </xsl:if>
    
    <div id="main-head">
      <xsl:apply-templates mode="a:main-head"/>
      <div class="spacer"/>
    </div>
        
    <div id="main-content" class='page-section content-section'>
      <xsl:apply-templates mode="a:main-content"/>
      <div class="spacer"/>
    </div>   
    
    <xsl:if test="$a:site-info">
      <div id="main-site-footer" class='page-section site-footer site-footer-section'>
        <xsl:apply-templates select="." mode="a:site-links-footer"/>
        <xsl:apply-templates select="." mode="a:site-footer"/>
        <div class="spacer"/>
      </div>   
    </xsl:if>
    
  </xsl:template> 
  
  <xsl:template match="a:content" mode="a:main-content">
    <xsl:apply-templates/>
  </xsl:template>
    
  <!--title -->
  <xsl:template name="a:page-header-title">
    <xsl:param name="title"/>
    <div class="title">
      <h1>
        <xsl:value-of select="$title"/>
      </h1>
      <div class="spacer"/>
    </div>    
  </xsl:template>
  
  <xsl:template match='a:title' mode="a:page-header">
    <xsl:param name="l10n" select="$o:title-l10n"/>
    <xsl:param name="key" select="@key"/>
    <div class="title">          
      <h1>
        <xsl:value-of select="concat($l10n[@key=$key],.)"/>  
      </h1>
      <div class="spacer"/>    
    </div>    
  </xsl:template>
  
  <xsl:template match='a:title' name="a:grouping-title">
    <xsl:param name="l10n" select="$o:title-l10n"/>
    <xsl:param name="key" select="@key"/>
    <h2>
      <xsl:if test="$key">
        <xsl:value-of select="concat($l10n[@key=$key],' ')"/>
      </xsl:if>      
      <xsl:value-of select="node()"/>  
    </h2>    
  </xsl:template>
  
  <xsl:template match='a:title' mode="a:node-title" name="a:node-title">
    <xsl:param name="l10n" select="$o:title-l10n"/>
    <xsl:param name="key" select="@key"/>
    <h3>
      <xsl:if test="$key">
        <xsl:value-of select="concat($l10n[@key=$key],' ')"/>
      </xsl:if>      
      <xsl:value-of select="node()"/>  
    </h3>    
  </xsl:template>
   
  <xsl:template match='a:msgs'>  
    <ul class='msgs {@role}'>
      <xsl:apply-templates>
        <xsl:with-param name="status-l10n" select="$o:l10n/l:context[@name='status']/*"/>
      </xsl:apply-templates>      
    </ul>
  </xsl:template>
  
  <xsl:template match='a:msg'>
    <xsl:param name="status-l10n" select="$o:l10n/l:context[@name='status']/*"/>
    <xsl:param name="key" select="@key"/>
    <li class="msg">        
      <xsl:value-of select="$status-l10n[@key=$key]"/>
      <div class="spacer"/>
    </li>
  </xsl:template>

  <xsl:template match='a:literal'>
    <div>
      <xsl:call-template name="a:lang-attr"/>
      <w:render-markup select='string(.)' 
        mime-type='{@format}' 
        url-params-string='{$a:common-url-params}' 
        url-resource-ext='{$a:resource-ext}'/>
    </div>
  </xsl:template>
  
  <xsl:template match='a:grouping' name="a:grouping">
    <div class="grouping">
      <xsl:if test="@id">
        <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
      </xsl:if>
      <xsl:attribute name="class">                      
        <xsl:choose>
          <xsl:when test="position() = 1">            
            <xsl:text>grouping first</xsl:text>
            <xsl:if test="position() = last()">
              <xsl:text> last</xsl:text>
            </xsl:if>
          </xsl:when>          
          <xsl:when test="position() = last()">
            <xsl:text>grouping last</xsl:text>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>grouping</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="@role">
          <xsl:value-of select="concat(' ',@role)"/>
        </xsl:if>
      </xsl:attribute>  
      <xsl:if test="@label">
        <h3 class="grouping_label">
          <xsl:value-of select="@label"/>
        </h3>
      </xsl:if>    
      <div class="grouping_body">
        <xsl:apply-templates/>
      </div>      
      <div class='spacer'/>
    </div>    
  </xsl:template>  
  
  <xsl:template match="a:dict">
    <xsl:param name="l10n" select="$o:l10n/l:content[@name='entry']/*"/>
    <div class="dict {@key}">
      <xsl:apply-templates mode="a:dict">
        <xsl:with-param name="l10n" select="$l10n"/>
      </xsl:apply-templates>
    </div>
  </xsl:template>
  
  <xsl:template match="a:entry" name="a:entry" mode="a:dict">
    <xsl:param name="l10n"/>
    <xsl:param name="key" select="@key"/>
    <div class='entry {$key}'>
      <div class='key'>
        <span><xsl:value-of select="$l10n[@key=$key]"/></span>
        <div class="spacer"/>
      </div>
      <div class='value'>
        <span><xsl:value-of select="."/></span>
        <div class="spacer"/>
      </div>      
      <div class="spacer"/>
    </div> 
  </xsl:template>
  
  <!-- xsl:template match="a:node-acls" mode="a:search-form" name="a:search-form-basic">
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='search-form']/*"/>
    <xsl:param name="acls" select="sess:has-acl($a:config/@root-uri,'search','sparql','versa')"/>
    
    <xsl:if test="$acls">
      <dl>
        <dt>
          <xsl:value-of select="$l10n[@key='title']"/>
        </dt>
      </dl>
      <div class='body'>   
        <div class='wrapper'> 
          <xsl:choose>
            <xsl:when test="$acls/@search and $a:action != 'search'">
              <xsl:variable name="request" select="a:format-request('search')"/>    
              <form method='post' action="{$request}">
                <div class="hidden">
                  <input type='hidden' name='quick-search' value='1'/>
                  <input type='hidden' name='search' value="{$l10n[@key='search-button']}"/>
                </div>
                <div class="inputs">
                  <input name='keywords' type='text' class='search_keywords' value=''/>
                  <input type='submit' name='event' value="{$l10n[@key='search-button']}"/>
                </div>     
              </form>
              <div class="advance-search keyword-query">
                <a href="{$request}">
                  <xsl:value-of select="$l10n[@key='keyword-query']"/>
                </a>
              </div>
            </xsl:when>
            <xsl:otherwise>
              <div class="advance-search keyword-query current-action">
                <xsl:value-of select="$l10n[@key='keyword-query']"/>
              </div>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:choose>
            <xsl:when test="$acls/@sparql and $a:action != 'sparql'">
              <div class="advance-search sparql-query">
                <a href="{a:format-request('sparql')}">
                  <xsl:value-of select="$l10n[@key='sparql-query']"/>
                </a>
              </div>
            </xsl:when>
            <xsl:otherwise>
              <div class="advance-search sparql-query current-action">
                <xsl:value-of select="$l10n[@key='sparql-query']"/>
              </div>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:choose>
            <xsl:when test="$acls/@versa and $a:action != 'versa'">
              <div class="advance-search versa-query">
                <a href="{a:format-request('versa')}">
                  <xsl:value-of select="$l10n[@key='versa-query']"/>
                </a>
              </div>
            </xsl:when>
            <xsl:otherwise>
              <div class="advance-search versa-query current-action">
                <xsl:value-of select="$l10n[@key='versa-query']"/>
              </div>
            </xsl:otherwise>
          </xsl:choose>
        </div>
        <div class='spacer search-body-spacer'></div>
      </div>
      <div class='spacer search-action-spacer'/>
    </xsl:if>
  </xsl:template -->
  
  <!-- xsl:template match="a:node-acls[a:acl[@action='search']]" mode="a:search-form" name="a:search-form-advance">
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='search-form']/*"/>
    <xsl:param name="action" select="a:format-node-action('search')"/>
    <xsl:param name="advance-url" select="$action"/>
    <dl>
      <dt>
        <xsl:value-of select="$l10n[@key='title']"/>
      </dt>
    </dl>
    <div class='body'>
      <div class='wrapper'>            
        <form method='post' action="{$action}">
          <div class="hidden">
            <input type='hidden' name='quick-search' value='1'/>
            <input type='hidden' name='search' value="{$l10n[@key='search-button']}"/>
          </div>
          <div class="inputs">
            <input name='keywords' type='text' class='search_keywords' value=''/>
            <input type='submit' name='event' value="{$l10n[@key='search-button']}"/> 
          </div>       
          <div class="input checkbox">
            <input name='range' type='checkbox'/>
            <span class="search_node_only"><xsl:value-of select="$l10n[@key='search-node-only']"/></span>
          </div>
        </form>
        <div class="advance-search">
          <a href="{$advance-url}">
            <xsl:value-of select="$l10n[@key='advanced-search']"/>
          </a>
        </div>
      </div>
      <div class='spacer search-body-spacer'/>
    </div>
    <div class='spacer search-action-spacer'/>
  </xsl:template -->
  
  <xsl:template name="a:even-odd-class-attr">
    <xsl:param name="initial" select="'entry'"/>
    <xsl:attribute name='class'>
      <xsl:value-of select="$initial"/>          
      <xsl:choose>
        <xsl:when test='position() mod 2'>
          <xsl:text> even</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text> odd</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
      <xsl:choose>
        <xsl:when test='position() = 1'>
          <xsl:text> first</xsl:text>
        </xsl:when>
        <xsl:when test='position() = last()'>
          <xsl:text> last</xsl:text>
        </xsl:when>
      </xsl:choose>
    </xsl:attribute>  
  </xsl:template>
  
  <xsl:template name="a:select-number">
    <xsl:param name="cur"/>
    <xsl:param name="max"/>
    <xsl:param name="step"/>
    <xsl:param name="selected"/>
    
    <xsl:if test="$cur &lt;= $max">
      <option value="{$cur}">
        <xsl:if test="$cur = $selected">
          <xsl:attribute name="selected">selected</xsl:attribute>
        </xsl:if>
        <xsl:value-of select="$cur"/>          
      </option>
      <xsl:call-template name="a:select-number">
        <xsl:with-param name="cur" select="$cur + $step"/>
        <xsl:with-param name="max" select="$max"/>
        <xsl:with-param name="step" select="$step"/>
        <xsl:with-param name="selected" select="$selected"/>        
      </xsl:call-template>
    </xsl:if>
   
  </xsl:template>  
  
  <xsl:template match="a:methods" mode="a:main-actions">
    <xsl:param name="method" select="/*/@method"/>
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='methods']/*"/>
    <div class="box action methods">
      <dl>
        <dt>
          <xsl:value-of select="$o:actions-l10n[@key='methods']"/>
        </dt>
      </dl>
      <div class='body'>
        <div class='wrapper'>
          <xsl:apply-templates select="a:method" mode="a:method-action">
            <xsl:with-param name="l10n" select="$l10n"/>
            <xsl:with-param name="method" select="$method"/>
          </xsl:apply-templates>
        </div> 
        <div class='spacer methods-body-spacer'/>
      </div>
      <div class='spacer methods-action-spacer'/>           
    </div>
    <xsl:call-template name="a:page-validation-services"/>
  </xsl:template> 
  
  <xsl:template match="a:method" mode="a:method-action" name="a:method-action">
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='methods']/*"/>
    <xsl:param name="key" select="@key"/>
    
    <div class="method">
      <xsl:variable name="label" select="$l10n[@key=$key]"/>
      <xsl:choose>
        <xsl:when test="string-length($label)">
          <xsl:choose>
            <xsl:when test="@selected">
              <xsl:value-of select="$label"/> 
            </xsl:when>
            <xsl:otherwise>
              <a href="{a:format-url-method($key)}">
                <xsl:value-of select="$label"/>
              </a>     
            </xsl:otherwise>
          </xsl:choose>       
        </xsl:when>
        <xsl:otherwise>
          <a href="{a:format-url-method($key)}">
            <xsl:value-of select="$key"/>
          </a>    
        </xsl:otherwise>
      </xsl:choose>     
      <div class="spacer"/>
    </div>
  </xsl:template>
  
  <xsl:template match="*" mode="a:method-option">
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='methods']/*"/>
    <xsl:param name="key" select="@key"/>
    
    <option value='{$key}'>
      <xsl:if test='@selected'>
        <xsl:attribute name='selected'>selected</xsl:attribute>
      </xsl:if>      
      <xsl:value-of select='$l10n[@key=$key]'/>
    </option>
  </xsl:template>
  
  <!-- site header and footer -->
  <xsl:template match="*" mode="a:site-header">
    <xsl:if test="$a:site-page">
      <xsl:copy-of select="$a:site-page[@class='header']/*"/>
    </xsl:if>
  </xsl:template>
  
  <xsl:template match="*" mode="a:site-links-header" name="a:site-links">
    <xsl:param name="quick-links" select="$a:site-info[@name='quick-links-header']/*"/>
    <xsl:param name="tag" select="'header'"/>
    <xsl:if test="$quick-links">
      <div class="quick-links quick-links-{$tag}">
        <ul>
          <xsl:for-each select="$quick-links">
            <li>
              <a href="{@href}" title="{@title}">
                <xsl:value-of select="."/>
              </a>
              <div class='spacer'/>
            </li>
          </xsl:for-each>
        </ul>
        <div class='spacer'/>
      </div>
    </xsl:if>
  </xsl:template>
  
  <xsl:template match="*" mode="a:site-links-footer">
    <xsl:call-template name="a:site-links">
      <xsl:with-param name="quick-links" select="$a:site-info[@name='quick-links-footer']/*"/>
      <xsl:with-param name="tag" select="'footer'"/>
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="*" mode="a:site-footer" name="a:site-footer">
    <xsl:if test="$a:site-page">
      <xsl:copy-of select="$a:site-page[@class='footer']/*"/>
    </xsl:if>
    <xsl:call-template name="a:site-footer-copyright"/>
  </xsl:template>
  
  <xsl:template name="a:site-footer-copyright">
    <xsl:param name="cpr" select="$a:site-info[@name='site-copyright']/*"/>
    <xsl:if test="$cpr">
      <div class="copyright">
        <div class="copyright-year">
          <xsl:variable name="year" select="$cpr[@key='year']"/>
          <xsl:choose>
            <xsl:when test="$year">
              <xsl:value-of select="$year"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="concat('&#169; ',date:year($a:source-root/@date-time))"/>
            </xsl:otherwise>
          </xsl:choose>
          <div class="spacer"/>
        </div>
        <xsl:variable name="url" select="$cpr[@key='holder-url']"/>
        <xsl:choose>
          <xsl:when test="$url">
            <div class="copyright-by">
              <a href="{$url}">
                <xsl:value-of select="$cpr[@key='holder']"/>
              </a>
              <div class="spacer"/>
            </div>
          </xsl:when>
          <xsl:otherwise>
            <div class="copyright-by">
              <span>
                <xsl:value-of select="$cpr[@key='holder']"/>
              </span>
              <div class="spacer"/>
            </div>
          </xsl:otherwise>
        </xsl:choose>
        <div class="spacer"/>
      </div>
    </xsl:if>
  </xsl:template>
  
  <xsl:template match="a:node-acls" mode="a:search-form" name="a:search-form-basic">
    <xsl:param name="l10n" select="$o:l10n/*[@name='quick-search-form']/*"/>
    <xsl:param name="no-referrer"/>
    <xsl:for-each select="$fres:config-doc/a:QuickSearchServices">
      <dl>
        <dt>
          <xsl:value-of select="$l10n[@key='title']"/>
        </dt>
      </dl>
      <div class='body'>   
        <div class='wrapper'>    
          <form method='post' action="/node/">
            <div class="hidden">
              <input type='hidden' name='quick-search' value='1'/>
              <input type='hidden' name='action' value='query'/>
              <input type='hidden' name='search' value="{$l10n[@key='search-button']}"/>
              <input type='hidden' name='locale' value="{$a:source-root/@content-locale}"/>
              <input type='hidden' name='method' value="{$a:method}"/>
              <input type='hidden' name='theme' value="{$a:theme}"/>
              <input type='hidden' name='http-post-encoding' value='iso-8859-1'/>        
              <input type='hidden' name='stage' value='0'/>
              <xsl:if test="$no-referrer">
                <input type='hidden' name='no-referrer' value='1'/>
              </xsl:if>
            </div>
            <div class="inputs">
              <div class="query_input">
                <input name='query' type='text' class='search_keywords' value=''/>
                <input type='submit' name='event' value="{$l10n[@key='search-button']}"/>
                <div class="spacer"/>
              </div>
              <div class='query_type_input'>
                <div class="label">
                  <xsl:value-of select="$l10n[@key='search-type-label']"/>
                  <div class="spacer"/>
                </div>
                <select name='furi'>
                  <xsl:variable name="types" select="$o:l10n/*[@name='quick-search-types']/*"/>
                  <xsl:for-each select="*">
                    <option value='{@uri}'>
                      <xsl:variable name="key" select="string(@type)"/>
                      <xsl:value-of select="$types[@key=$key]"/>
                    </option>
                  </xsl:for-each>
                </select>
                <div class="spacer"/>
              </div>
              <div class="spacer"/>
            </div>
            <div class="spacer"/>
          </form>
          <div class="spacer"/>
        </div>
        <div class="spacer"/>
      </div>
    </xsl:for-each>
  </xsl:template>
  
  <!-- configure this into site-page -->
  <!-- xsl:template match="l:img" mode="a:site-footer-sponsors">
    <div class="sponsor sponsor-img">
      <xsl:if test="@title">
        <div class="key">
          <h3>
            <xsl:value-of select="@title"/>
          </h3>
          <div class="spacer"/>
        </div>
      </xsl:if>
      <div class="value">
        <a href="{@link}" title="{@alt}">
          <img src="{.}" alt="{@alt}"/>
        </a>
        <div class="spacer"/>
      </div>
      <div class="spacer"/>
    </div>
  </xsl:template>
  
   <xsl:template match="l:link" mode="a:site-footer-sponsors">
    <div class="sponsor sponsor-link">
      <xsl:if test="@title">
        <div class="key">
          <h3>
            <xsl:value-of select="@title"/>
          </h3>
          <div class="spacer"/>
        </div>
      </xsl:if>
      <div class="value">
        <a href="{@link}">
          <xsl:value-of select="."/>
        </a>
        <div class="spacer"/>
      </div>
      <div class="spacer"/>
    </div>
  </xsl:template -->
  
  <xsl:template name="a:page-validation-services">
    <xsl:param name="l10n" select="$o:l10n/l:context[@name='page-validation-services']/*"/>
    <xsl:param name="theme" select="$o:theme-i18n[@name='page-validation-services']/*"/>
    
    <xsl:variable name="is-rdf" select="*[@key='rdf']"/>    
    <xsl:variable name="uri" 
      select="url:quote(concat('http://',$a:http-host,a:format-url-method('rdf')))"/>
      
    <!-- div id='page-validation' class='box action page-validation'>
      <dl>
        <dt>
          <xsl:value-of select="$o:actions-l10n[@key='page-validation-services']"/>
        </dt>
      </dl>
      <div class='body'>
        <div class='wrapper'>
          <xsl:if test="$is-rdf">
            <div class='rdf-validation'>
              <xsl:variable name="a" select="$l10n[@key='rdf']"/>
              <xsl:variable name="img" select="$theme[@key='rdf']"/>
              <a href="{concat($a/@href,$uri)}" title="{$a}" class="img">
                <img src="{$img/@src}" 
                  alt="{$a}">
                </img>
              </a>
              <div class="spacer"/>
            </div>   
          </xsl:if>
          <div class='markup-validation'>
            <xsl:variable name="a" select="$l10n[@key=$a:method]"/>
            <xsl:variable name="img" select="$theme[@key=$a:method]"/>
            <a href="{$a/@href}" title="{$a}" class="img">
              <img src="{$img/@src}" 
                alt="{$a}">
              </img>
            </a>
            <div class="spacer"/>
          </div>   
          <div class='css-validation'>
            <xsl:variable name="a" select="$l10n[@key='css']"/>
            <xsl:variable name="img" select="$theme[@key='css']"/>
            <a href="{$a/@href}" title="{$a}" class="img">
              <img src="{$img/@src}" 
                alt="{$a}">
              </img>
            </a>
            <div class="spacer"/>
          </div>   
        </div>
        <div class="spacer page-validation-body-spacer"/>
      </div> 
      <div class='spacer page-validation-action-spacer'/>           
    </div -->
    <xsl:if test="$is-rdf">
      <div class='simple-action'>
        <xsl:variable name="a" select="$l10n[@key='rdf']"/>
        <xsl:variable name="img" select="$theme[@key='rdf']"/>
        <a href="{concat($a/@href,$uri)}" title="{$a}" class="img">
          <img src="{$img/@src}" 
            alt="{$a}">
          </img>
        </a>
        <div class="spacer"/>
      </div>
      <div id='external-semantic-web-browse' class='simple-action'>
        <xsl:variable name="a" select="$l10n[@key='semantic-web-browser']"/>
        <xsl:variable name="img" select="$theme[@key='semantic-web-browser']"/>
        <xsl:value-of select="$l10n[@key='semantic-web-browser-description']"/>
        <a href="{concat($a/@href,$uri)}" title="{$a}" class="img">
          <img src="{$img/@src}" 
            alt="{$a}">
          </img>
        </a>
        <div class="spacer"/>
      </div>
    </xsl:if>    
  </xsl:template>
   
</xsl:stylesheet>
